import areaData from 'china-area-data'
import _ from 'lodash'
console.info(areaData)
window.areaData = areaData
let treeData = []

function transfer(obj){
	let name,item
	obj.list = []
	for(let prop in areaData[obj.code]){
		item = {
			code: prop,
			name: areaData[obj.code][prop]
		}
		if(areaData.hasOwnProperty(prop)){
			transfer(item)
		}
		obj.list.push(item)
	}
}

for(let prop in areaData['86']){
	treeData.push({code: prop, name: areaData['86'][prop]})
}
for(let prop in treeData){
	transfer(treeData[prop])
}


console.log(JSON.stringify(treeData));